home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-05-01 | 3.9 KB | 126 lines | [TEXT/MPS ] |
- % ---------------------------------------------------------------------------
- % Class Mac WindowMgr
- %
- % In this module you find the programmers interface to the Window
- % Manager.It is built on top of the TOOLBOX routines in TOOLBOXWindows.
- % The routines put here are those that are not naturally an attribute of
- % a window, rather manageing the windows. This class is only intended to
- % be instantiated once (and usually as the part of its subclass
- % macProcessMGR)
- % When an object of this class is created, all other Toolbox Managers
- % are initialized. This should naturally only be done Once.
- %
- % For a description of the routines see Inside Macintosh.
- %
- % 890317/Boris Magnusson
- % This module contains an internal Simset list of notices to all
- % created Windows.
- % ---------------------------------------------------------------------------
- External class TOOLBOXWindow="::SInterfaces:ToolboxWindow";
- External class MACWindow="::SInterfaces:MacWindow";
- External class MACRect="::SInterfaces:MacRect";
- External class MacPoint="::SInterfaces:MacPoint";
- External class MacToolConst="::SInterfaces:MacToolConst";
- External class MacUtilities="::SInterfaces:MacUtilities";
-
- Simset class MacWindowMgr;
- begin
-
- ref(MacUtilities) Util; ! To access general utilities of Toolbox;
- ref(MacToolConst) TConst; ! To access CONST:s from Toolintf;
- ref(TOOLBOXWindow) TOOLBOX;! To access Quickdraw & Window traps;
- ref(macWindow) SelectedWindow;! The currently selected W. ;
- ! ----------------------------;
- integer NIL=0;
-
- procedure InitWindows; TOOLBOX.TOOLBOXInitWindows;
-
- procedure RegisterWindow(W); ref(macWindow) W;
- begin
- new WindowNotice(W);
- SelectWindow(W); ! make new Window the selected one ;
- end;
-
- procedure SelectWindow(W);ref(macWindow) W;
- begin
- TOOLBOX.TOOLBOXSelectWindow(W.WindowPtr);
- W.Setport;
- SelectedWindow:-W;
- end --- Select Window --- ;
-
- procedure DisposeWindow(W); ref(MACWindow) W;
- begin
- TOOLBOX.TOOLBOXDisposeWindow(W.WindowPtr);
- ConvertToNotice(W.WindowPtr).out;
- end;
-
- ref(MACWindow) procedure FrontWindow;
- FrontWindow:-ConvertToWindow(TOOLBOX.TOOLBOXFrontWindow);
-
- short integer procedure FindWindow(thePoint,WhichWindow);
- name WhichWindow;
- ref(MACPoint) thePoint;
- ref(MacWindow) WhichWindow;
- begin integer W;
- FindWindow:=TOOLBOX.TOOLBOXFindWindow(thePoint.h,thePoint.v,W);
- WhichWindow:-ConvertToWindow(W)
- end;
-
- % Special routine to reach the screen rectangle
-
- external Pascal procedure x="PascalGetScreenRect" is
- procedure PascalGetScreenRect(theRect_top);
- name theRect_top;
- short integer theRect_top;;
-
- procedure GetScreenRect(aRect); ref(MACRect) aRect;
- begin
- PascalGetScreenRect(aRect.Top);
- end;
-
- % ---------------------------------------------------------
-
- ! -------- Internal Routines --------------- ;
-
- ref(MACWindow) procedure ConvertToWindow(windowptr); integer windowptr;
- begin
- ! search all created windows for one with windowptr
- ! equal to the param;
- ref(windowNotice) p;
- p:-wq.first;
- while p=/= none and then p.W.Windowptr<>Windowptr do
- p:-p.suc;
- if p=/=none then
- ConvertToWindow:-p.W
- else
- begin ! else not our window ;
- ghostWindow.Windowptr:=windowptr;
- convertToWindow:-ghostWindow;
- end;
- end;
-
- ref(WindowNotice) procedure ConvertToNotice(windowptr); integer windowptr;
- begin
- ! search all created windows for one with windowptr
- ! equal to the param;
- ref(windowNotice) p;
- p:-wq.first;
- while p=/= none and then p.W.Windowptr<>Windowptr do
- p:-p.suc;
- if p=/=none then
- ConvertToNotice:-p; ! else not a window hit ;
- end;
-
- link class WindowNotice(W); ref(MACWindow) W; into(WQ);
-
- ! -- Initialization --- ;
- ref(MacWindow) GhostWindow; ! used to reprsent windows
- ! in other Applications ;
- ref(Head) WQ;
- WQ:-new Head;
-
- Util:-new MacUtilities; ! To access general utilities of Toolbox;
- TConst:-new MacToolConst; ! To access CONST:s from Toolintf;
- TOOLBOX:-new TOOLBOXWindow;! To access Quickdraw & Window traps;;
- GhostWindow:- new MacWindow;
- END --- MAC Window Manager --- ;